<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/modules/cms/front/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>课程列表</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="decorator" content="ems_${site.theme}_front" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="description" content="${site.description}" />
<meta name="keywords" content="${site.keywords}" />
<link rel="stylesheet" href="${ctxStatic}/sdsng/lib/weui.min.css">
<link rel="stylesheet" href="${ctxStatic}/sdsng/css/jquery-weui.css">
<link rel="stylesheet" href="${ctxStatic}/sdsng/css/style.css">
</head>
<body ontouchstart>
<!--顶部搜索-->
<header class="wy-header">
 
</header>
<header class='weui-header fixed-top'>
 <div class="wy-header-icon-back"><span></span></div>
  <div class="wy-header-title">列表</div>
  <div class="weui-search-bar" id="searchBar">
    <form class="weui-search-bar__form" id="searchForm" action="${ctx }/courseList">
    
      <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
	  <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
	  <input id="siteId" name="siteId" type="hidden" value="${site.id}"/>
	  <input id="deptId" name="major.dept.id" type="hidden" value="${emsCourse.major.dept.id}"/>
	  <input id="termId" name="term.id" type="hidden" value="${emsCourse.term.id}"/>
	  <input id="majorId" name="major.id" type="hidden" value="${emsCourse.major.id}"/>
    
      <div class="weui-search-bar__box">
        <i class="weui-icon-search"></i>
        <input type="search" class="weui-search-bar__input" name="name" id="searchInput" onkeyup="checkKey(event);" placeholder="请输入你要搜索的课程" required>
        <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
      </div>
      <label class="weui-search-bar__label" id="searchText" style="transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
        <i class="weui-icon-search"></i>
        <span>请输入你要搜索的课程</span>
      </label>
    </form>
    <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
  </div>
</header>
<!--主体-->
<div class="weui-content" style="padding-top:85px;">
  <!--产品列表--滑动加载-->
  <!-- <div class="weui-pull-to-refresh__layer">
    <div class='weui-pull-to-refresh__arrow'></div>
    <div class='weui-pull-to-refresh__preloader'></div>
    <div class="down">下拉刷新</div>
    <div class="up">释放刷新</div>
    <div class="refresh">正在刷新</div>
  </div> -->
  <div id="list" class='demos-content-padded proListWrap'>
  
    <%-- <div class="pro-items">
      <a href="pro_info.html" class="weui-media-box weui-media-box_appmsg">
        <div class="weui-media-box__hd"><img class="weui-media-box__thumb" src="${ctxStatic}/sdsng/upload/jingxuan1.jpg" alt=""></div>
        <div class="weui-media-box__bd">
          <h1 class="weui-media-box__desc"> 剑桥英语1级1班</h1>
          <div class="wy-pro-pri">¥<em class="num font-15">296.00</em> <div style="float:left; margin-right:10px; color:#333333; font-size:12px">课时：16课时</div></div>
		   <div style="font-size:12px; color:#666666">开课时间：2018-10-10</div>
		   <div style="font-size:12px; color:#666666">招生人数：<b>20</b>人 剩余:<font color="red"><b>10</b></font>人</div>
        </div>
      </a>
    </div> --%>
    <c:forEach items="${page.list }" var="course">
	    <div class="pro-items">
	      <a href="${ctx }/courseInfo?siteId=${site.id}&id=${course.id}&term.id=${emsCourse.term.id}&major.id=${emsCourse.major.id}&major.dept.id=${emsCourse.major.dept.id}" class="weui-media-box weui-media-box_appmsg">
	        <div class="weui-media-box__hd"><img class="weui-media-box__thumb" src="${course.logo }" alt=""></div>
	        <div class="weui-media-box__bd">
	          <h1 class="weui-media-box__desc"> ${course.name }</h1>
	          <div class="wy-pro-pri">¥<em class="num font-15"><fmt:formatNumber type="number" value="${empty course.fee ? '0' : course.fee}" pattern="0.00" maxFractionDigits="2"/></em> <div style="float:left; margin-right:10px; color:#333333; font-size:12px">课时：16课时</div></div>
			   <div style="font-size:12px; color:#666666">开课时间：
			   <c:if test="${not empty course.beginTime}">
			   		<fmt:formatDate value="${course.beginTime}" pattern="yyyy-MM-dd"/>
			   </c:if>
			   <c:if test="${empty course.beginTime}">
			   		无
			   </c:if>
			   </div>
			   <div style="font-size:12px; color:#666666">招生人数：<b>${empty course.num ? '0' : course.num}</b>人 剩余:<font color="red"><b>${course.num - course.hasNum}</b></font>人</div>
	        </div>
	      </a>
	    </div>
    </c:forEach>

  </div>
  <!-- <div class="weui-loadmore">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加载</span>
  </div> -->
 
 <div class="weui-loadmore">
    ${page.pageWeiXin}
  </div>
  
</div>

<script src="${ctxStatic}/sdsng/lib/jquery-2.1.4.js"></script> 
<script src="${ctxStatic}/sdsng/lib/fastclick.js"></script> 
<script>
  $(function() {
    FastClick.attach(document.body);
  });
</script> 
<script src="${ctxStatic}/sdsng/js/jquery-weui.js"></script>
<script>
      $(document.body).pullToRefresh().on("pull-to-refresh", function() {
        setTimeout(function() {
          $("#time").text(new Date);
          $(document.body).pullToRefreshDone();
        }, 2000);
      });
      // infinite
      /* var loading = false;
      $(document.body).infinite().on("infinite", function() {
        if(loading) return;
        loading = true;
        setTimeout(function() {
          $("#list").append('<div class="pro-items"><a href="pro_info.html" class="weui-media-box weui-media-box_appmsg"><div class="weui-media-box__hd"><img class="weui-media-box__thumb" src="upload/pro3.jpg" alt=""></div><div class="weui-media-box__bd"><h1 class="weui-media-box__desc">由各种物质组成的巨型球状天体，叫做星球。星球有一定的形状，有自己的运行轨道。</h1><div class="wy-pro-pri">¥<em class="num font-15">296.00</em></div><ul class="weui-media-box__info prolist-ul"><li class="weui-media-box__info__meta"><em class="num">0</em>条评价</li><li class="weui-media-box__info__meta"><em class="num">100%</em>好评</li></ul></div></a></div>');
          loading = false;
        }, 2000);
      }); */
      
      
      function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
      	return false;
      }
      
      function checkKey(event)
      {
    	  // 当按键是“回车”或者手机软键盘“搜索”时，提交
    	  if(event.keyCode == 13)
    	  {
    		  $("#searchForm").submit();
    	  }
      }
      
</script>
</body>
</html>